import { request, requestFy } from "@/utils/request";

// 获取运输计划列表
export function getTranPlanList(data) {
  return request({
    url: "/queue/trans-plan-mgr/page",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}

// 获取拉货运单列表
export function getOrderLists(data) {
  return requestFy({
    url: "/wechat/find-order-from-enterApplet",
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}

// 获取拉货运单列表(销售)
export function getSaleWaybillPage(params) {
  return request({
    url: "/queue/sale-waybill/get-saleWaybill-page",
    method: "GET",
    params,
  });
}
// 查询装车列表
export function getLoadingDatas(data) {
  return request({
    url: "/loading-user-work/get-loading-list",
    method: "POST",
    data: data,
  });
}

// 确认装车
export function confirmLoaded(data) {
  return request({
    url: `/loading-user-work/start-loading?loadingId=${data.loadingId}&userId=${data.userId}`,
    method: "GET",
  });
}

// 装车-产品
export function productLists() {
  return request({
    url: `/loading-user-work/get-coal-product`,
    method: "GET",
  });
}

// 销售运单-取消操作
export function editSaleWaybill(data) {
  return request({
    url: "/queue/sale-waybill/saleWaybill-edit",
    method: "POST",
    data,
  });
}

// 销售运单-通过id查询产品列表
export function findProCusRelName(params) {
  return request({
    url: "/queue/sale-waybill/find-proCus-relName",
    method: "GET",
    params,
  });
}

// 销售运单-通过id查询卸货地列表
export function findcusAddressbyCusId(params) {
  return request({
    url: "/queue/sale-waybill/find-cusAddress-byCusId",
    method: "GET",
    params,
  });
}
// 销售运单审核前查询是否来自运输计划
export function getPlanFromWhere(waybillno) {
  return requestFy({
    url: "/coal-order/get-plan-info-by-plan-no/" + waybillno,
    method: "GET",
    headers: {
      isToken: false,
    },
  });
}
// 销售运单-审核通过
export function saleWaybillAudit(data) {
  return request({
    url: "/queue/sale-waybill/saleWaybill-audit",
    method: "POST",
    data,
  });
}

// 销售运单-查询详情
export function getSaleWaybillbyId(params) {
  return request({
    url: "/queue/sale-waybill/get-saleWaybill-byId",
    method: "GET",
    params,
  });
}
export const getGoodsSourceByPlanId = async (params) => {
  return request({
    url: "/queue/goods-source/getByPlanId",
    method: "GET",
    params,
  });
};
// 运输计划列表
export function getPlanList(data) {
  return request({
    url: "/queue/transport-plan/page-applet",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}
// 运输计划创建
export function createPlan(data) {
  return request({
    url: "/queue/transport-plan/create-applet",
    method: "POST",
    data,
  });
}
// 运输计划详情
export function getPlanDetail(id) {
  return request({
    url: `/queue/transport-plan/get-applet?id=${id}`,
    method: "GET",
  });
}
// 查询企业基础配置
export function getEnterBasic(tenantId) {
  return requestFy({
    url: `/coal-basisDeploy/find-tenant/${tenantId}`,
    method: "GET",
  });
}
// 运输计划erp订单下拉数据源
export function getPlanERPDatas() {
  return request({
    url: `/queue/transport-plan/get-sale-purchase-transport-plan-simple-list-applet?bizType=1`,
    method: "GET",
  });
}
// 运输计划取消
export function cancelPlanDetail(params) {
  return request({
    url: "/queue/transport-plan/cancellation-applet",
    method: "GET",
    params,
  });
}
// 预约调价分页
export function adjustPricePages(params) {
  return request({
    url: "/queue/appointment-price-adjustment/page-applet",
    method: "GET",
    params,
  });
}
// 创建预约调价
export function createAdjustprice(data) {
  return request({
    url: "/queue/appointment-price-adjustment/create-applet",
    method: "POST",
    data,
  });
}
// 作废预约调价
export function cancelAdjustPrice(params) {
  return request({
    url: "/queue/appointment-price-adjustment/cancel-applet",
    method: "GET",
    params,
  });
}
// 判断是否单采
export function getPurModel() {
  return request({
    url: "/queue/tenant-configget-current-purchase-biz-mode",
    method: "GET",
  });
}
// 获取派车单数据
export function getBingddingWaybill(data) {
  return requestFy({
    url: `/coal-bidding/get-coal-bidding/app`,
    method: "POST",
    data,
  });
}
